#import "UnwindPulseController.h"
        
#import "UnwindPulseModel.h"
#import "UnwindPulseCell.h"
#import "Masonry.h"

@interface UnwindPulseController () <UICollectionViewDataSource, UICollectionViewDelegate>

@property (nonatomic, strong) UICollectionView *voyageCollectionView;
@property (nonatomic, strong) NSMutableArray *swayDataSource;

@end

@implementation UnwindPulseController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self windfallInitview];
	[self kindredSpiralgetData];
}


//: 懒加载数据模型数组
- (NSMutableArray *)swayDataSource {
	if (!_swayDataSource) {
		_swayDataSource = [NSMutableArray array];
	}
	return _swayDataSource;
}

- (void)windfallInitview {
    UICollectionViewFlowLayout *kindred = [[UICollectionViewFlowLayout alloc] init];
    kindred.minimumLineSpacing = 10;
    kindred.minimumInteritemSpacing = 10;
    kindred.itemSize = CGSizeMake(100, 100);
    kindred.scrollDirection = UICollectionViewScrollDirectionVertical;
    
    self.voyageCollectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:kindred];
    self.voyageCollectionView.backgroundColor = UIColor.clearColor;
    self.voyageCollectionView.delegate = self;
    self.voyageCollectionView.dataSource = self;
    self.voyageCollectionView.showsHorizontalScrollIndicator = NO;
    self.voyageCollectionView.showsVerticalScrollIndicator = NO;
    [self.voyageCollectionView registerClass:[UnwindPulseCell class] forCellWithReuseIdentifier:NSStringFromClass([UnwindPulseCell class])];
    
    [self.view addSubview:self.voyageCollectionView];
    [self.voyageCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
}

//: 获取数据模型
- (void)kindredSpiralgetData {
	
}

#pragma mark - UICollectionView DataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.swayDataSource.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    UnwindPulseCell *zephyr = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([UnwindPulseCell class]) forIndexPath:indexPath];
    return zephyr;
}

#pragma mark - UICollectionView Delegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    //: collectioncell 点击
}


@end
